package app.server.project.main.service.controller;

import app.server.project.json.DeviceType;
import app.server.project.json.DeviceTypeMgr;
import app.server.project.main.service.dto.device.GenUUidReq;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 设备基础信息管理模块
 */
@RestController
@RequestMapping("/device/base")
@Slf4j
@AllArgsConstructor
public class DeviceBaseController {

    private DeviceTypeMgr deviceTypeMgr;
    /**
     * 获取设备类型id
     * @return
     */
    @GetMapping("/getDevices")
    public List<DeviceType> getDevices(){
        return deviceTypeMgr.getCacheData().values().stream().map((v)->{
            return (DeviceType)v;
        }).toList();
    }

    /**
     * 生成设备二维码
     * @param model
     * @return
     */
    @PostMapping("/genDeviceId")
    public String genDeviceId(@RequestBody GenUUidReq model){

        return "/static/app-server-project-web/data/outlooktree.txt";
    }

}
